home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / EnvelopeState.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  2.3 KB  |  66 lines  |  [TEXT/KAHL]

  1. /* EnvelopeState.h */
  2.  
  3. #ifndef Included_EnvelopeState_h
  4. #define Included_EnvelopeState_h
  5.  
  6. /* EnvelopeState module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* FastFixedPoint */
  12. /* Envelope */
  13. /* Memory */
  14. /* LinearTransition */
  15. /* Frequency */
  16. /* FloatingPoint */
  17.  
  18. #include "FastFixedPoint.h"
  19.  
  20. struct EvalEnvelopeRec;
  21. typedef struct EvalEnvelopeRec EvalEnvelopeRec;
  22.  
  23. /* forwards */
  24. struct EnvelopeRec;
  25.  
  26. /* flush cached envelope state records */
  27. void                                FlushEvalEnvelopeStateRecords(void);
  28.  
  29. /* dispose of an envelope state record */
  30. void                                DisposeEnvelopeStateRecord(EvalEnvelopeRec* State);
  31.  
  32. /* create a new envelope state record.  Accent factors have no effect with a value */
  33. /* of 1, attenuate at smaller values, and amplify at larger values. */
  34. EvalEnvelopeRec*        NewEnvelopeStateRecord(struct EnvelopeRec* Template,
  35.                                             float Accent1, float Accent2, float Accent3, float Accent4,
  36.                                             float FrequencyHertz, float Loudness, float HurryUp,
  37.                                             float TicksPerSecond, long* PreOriginTime);
  38.  
  39. /* when all envelopes have been computed, then the total (i.e. largest) pre-origin */
  40. /* time will be known and we can tell all envelopes how long they must wait */
  41. /* before starting */
  42. void                                EnvelopeStateFixUpInitialDelay(EvalEnvelopeRec* State,
  43.                                             long MaximumPreOriginTime);
  44.  
  45. /* perform a single cycle of the envelope and return the amplitude for it's */
  46. /* point.  should be called at key-down to obtain initial amplitude. */
  47. FastFixedType                EnvelopeUpdate(EvalEnvelopeRec* State);
  48.  
  49. /* find out if envelope has reached the end */
  50. MyBoolean                        IsEnvelopeAtEnd(EvalEnvelopeRec* State);
  51.  
  52. /* create key-up impulse.  call this before calling EnvelopeUpdate during a */
  53. /* given cycle.  this call preserves the current level of the envelope but */
  54. /* skips to the phase after the particular sustain. */
  55. void                                EnvelopeKeyUpSustain1(EvalEnvelopeRec* State);
  56. void                                EnvelopeKeyUpSustain2(EvalEnvelopeRec* State);
  57. void                                EnvelopeKeyUpSustain3(EvalEnvelopeRec* State);
  58.  
  59. /* retrigger envelopes from the origin point */
  60. void                                EnvelopeRetriggerFromOrigin(EvalEnvelopeRec* State,
  61.                                             float Accent1, float Accent2, float Accent3, float Accent4,
  62.                                             float FrequencyHertz, float Loudness, float HurryUp,
  63.                                             float TicksPerSecond, MyBoolean ActuallyRetrigger);
  64.  
  65. #endif
  66.